package com.health.trans.pojo;

import com.health.trans.annotation.TransValid;
import com.health.trans.common.util.GenericUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;

import javax.validation.Valid;
import java.util.List;

/**
 * 接收数据抽取参数
 *
 * @author 666
 */
@Data
@Slf4j
@ApiModel(description = "数据抽取参数")
@TransValid
@Accessors(chain = true)
public class TransParam {

    private ReaderJson reader;
    private WriterJson writer;

    /**
     * 需要抽取的表信息
     */
    @ApiModelProperty("表信息")
    @Valid
    private List<TableInfo<?>> tables;

    /**
     * 是否使用线程池配置
     */
    private Boolean isParallel;

    private Integer parallelNum = 5;


    public <T> List<TableInfo<T>> getTables() {
        return GenericUtil.get(tables);
    }

}
